
  
  <template>
  <div class="page pageScroll">
    <el-form
      :model="queryParams"
      ref="queryFormRef"
      :inline="true"
      label-width="68px"
    >
      <el-form-item label="教师姓名" prop="realName">
        <el-input
          v-model="queryParams.realName"
          clearable
          @keyup.enter="handleQuery"
          class="!w-240px"
        />
      </el-form-item>
      <el-form-item label="手机号" prop="phone">
        <el-input
          v-model="queryParams.phone"
          clearable
          @keyup.enter="handleQuery"
          class="!w-240px"
        />
      </el-form-item>
      <el-form-item>
        <el-button @click="handleQuery">搜索</el-button>
        <el-button @click="resetQuery">重置</el-button>
        <el-button type="success" plain @click="onExport">导出</el-button>
      </el-form-item>
    </el-form>

    <el-table :data="list" :loading="loading">
      <el-table-column label="序号" align="center" prop="_index" />

      <el-table-column label="公司名称" align="center" prop="organizationName">
      </el-table-column>
      <el-table-column label="所属部落" align="center" prop="tribeName">
      </el-table-column>
      <el-table-column label="教师姓名" align="center" prop="realName">
      </el-table-column>
      <el-table-column label="教师性别" align="center" prop="sex">
        <template #default="scope">
          <tag :value="scope.row.sex" type="sex"></tag>
        </template>
      </el-table-column>
      <el-table-column label="手机号" width="120px" align="center" prop="phone">
      </el-table-column>
      <el-table-column label="国籍" align="center" prop="countryName">
      </el-table-column>
      <el-table-column
        label="注册日期"
        width="200px"
        align="center"
        prop="createTime"
      >
      </el-table-column>
      <el-table-column label="是否可用" align="center" prop="isDelete">
        <template #default="scope">
          <tag :value="scope.row.isDelete" type="isDelete"></tag>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <el-pagination :="pagination" class="padding10" />
  </div>
</template>
  
<script setup lang="ts">
import API from '@/api/api';
import { CONST_VALUE } from '@/utils/const';
import { useTablePage } from '@/hooks/useTablePage';
const router = useRouter();
const {
  queryParams,
  queryFormRef,
  loading,
  total,
  list,
  handleQuery,
  resetQuery,
  handleDelete,
  pagination,
  exportHandle,
} = useTablePage({
  queryApi: API.teacherController.list,
  exportApi: API.teacherController.export,
});

function toEditPage(id?: number) {
  router.push({
    name: 'editTeacher',
    query: {
      id,
    },
  });
}
function toImportPage() {
  router.push({
    name: 'importTeacher',
  });
}
function onExport() {
  exportHandle({
    fileName: '教师列表',
  });
}
</script>